package com.joyveb.webtest.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lombok.AllArgsConstructor;
import lombok.Data;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.joyveb.session.http.ExpiringSessionHttpSession;

@Controller
@RequestMapping(value = "/test")
public class TestController {

	@ResponseBody
	@RequestMapping(method = RequestMethod.GET)
	public TestBean hello(HttpServletRequest request, HttpServletResponse response) {
		System.out.println("session:"+request.getSession().getId());
		System.out.println("session isExpired:"+((ExpiringSessionHttpSession)request.getSession()).getSession().isExpired());
		Prop p = new Prop(null, null);
		TestBean tb = new TestBean("key", p);
		return tb;
	}
	
	@AllArgsConstructor
	public @Data static class TestBean{
		public String key;
		public Prop value;
	}
	
	@AllArgsConstructor
	public @Data static class Prop{
		public String key;
		public String value;
	}
	
	
}
